package com.seed.core.pojo.seed;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.seed.core.enumeration.ColumnType;

import java.util.HashMap;
import java.util.Map;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class Column1 implements Property {
    private String name;
    /**
     * 数据库的字段类型，比如 varchar/tinyint 等
     */
    private ColumnType type;
    /**
     * 属性名称， 即字段名称转驼峰命名
     */
    private String field;
    /**
     * 数据库中的字段长度，比如 varchar(32) 中的 32
     */
    private Integer length;
    private String label;
    /**
     * 字段注释。
     */
    private String comment; //REMARKS
    private String defVal; //COLUMN_DEF 默认值

    private Integer precision;
    private Integer scale;
    private Boolean required;
    private Boolean unique;
    private Object min;
    private Object max;
    private String rel;
    private Map<String, String> options;

    private Boolean isLarge;
    private String onInsertValue;
    private String onUpdateValue;

    private String typeHandler;

//    public Column clone() {
//        Column ret = new Column();
//        ret.setName(name);
//        ret.setType(type);
//        ret.setField(field);
//        ret.setLength(length);
//        ret.setLabel(label);
//        ret.setComment(comment);
//        ret.setDefVal(defVal);
//        ret.setPrecision(precision);
//        ret.setScale(scale);
//        ret.setRequired(required);
//        ret.setUnique(unique);
//        ret.setMin(min);
//        ret.setMax(max);
//        ret.setRel(rel);
//
//        if(options != null) ret.setOptions(new HashMap<>(options));
//
//        ret.setLarge(isLarge);
//        ret.setOnInsertValue(onInsertValue);
//        ret.setOnUpdateValue(onUpdateValue);
//        ret.setTypeHandler(typeHandler);
//
//        return ret;
//    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public ColumnType getType() {
        return type;
    }

    public void setType(ColumnType type) {
        this.type = type;
    }

    public String getField() {
        return field;
    }

    public void setField(String field) {
        this.field = field;
    }

    public Integer getLength() {
        return length;
    }

    public void setLength(Integer length) {
        this.length = length;
    }

    @Override
    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    @Override
    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public String getDefVal() {
        return defVal;
    }

    public void setDefVal(String defVal) {
        this.defVal = defVal;
    }

    public Integer getPrecision() {
        return precision;
    }

    public void setPrecision(Integer precision) {
        this.precision = precision;
    }

    public Integer getScale() {
        return scale;
    }

    public void setScale(Integer scale) {
        this.scale = scale;
    }

    public Boolean getRequired() {
        return required;
    }

    public void setRequired(Boolean required) {
        this.required = required;
    }

    public Boolean getUnique() {
        return unique;
    }

    public void setUnique(Boolean unique) {
        this.unique = unique;
    }

    public Object getMin() {
        return min;
    }

    public void setMin(Object min) {
        this.min = min;
    }

    public Object getMax() {
        return max;
    }

    public void setMax(Object max) {
        this.max = max;
    }

    public String getRel() {
        return rel;
    }

    public void setRel(String rel) {
        this.rel = rel;
    }

    public Map<String, String> getOptions() {
        return options;
    }

    public void setOptions(Map<String, String> options) {
        this.options = options;
    }

    public Boolean getLarge() {
        return isLarge;
    }

    public void setLarge(Boolean large) {
        isLarge = large;
    }

    public String getOnInsertValue() {
        return onInsertValue;
    }

    public void setOnInsertValue(String onInsertValue) {
        this.onInsertValue = onInsertValue;
    }

    public String getOnUpdateValue() {
        return onUpdateValue;
    }

    public void setOnUpdateValue(String onUpdateValue) {
        this.onUpdateValue = onUpdateValue;
    }

    public String getTypeHandler() {
        return typeHandler;
    }

    public void setTypeHandler(String typeHandler) {
        this.typeHandler = typeHandler;
    }
}

